{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
    {load href="__CSS__video-js.min.css"}
    {load href="__JS__video.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
        margin-left: 3.333px;
    }

    .search {
        margin-bottom: 0px !important;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
          <div class="fixed-table-toolbar">
              <a class="btn btn-default btn-outline {present name='cate'}{eq name='cate' value='1'}asdlkjasd{/eq}{/present}" href="{:url('content',['cate' => 1])}">flag打卡</a>
              <a class="btn btn-default btn-outline {present name='cate'}{eq name='cate' value='2'}asdlkjasd{/eq}{/present}" href="{:url('content',['cate' => 2])}">地点打卡</a>
          </div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                               <div class="columns columns-right btn-group pull-left" >
                                   <select class="form-control" name="search_type">
                                       <option value="content" {present name='search_type'}{eq name='search_type' value='content'}selected{/eq}{/present}>内容</option>
                                       <option value="id" {present name='search_type'}{eq name='search_type' value='id'}selected{/eq}{/present}>动态ID</option>
                                       <option value="user_id" {present name='search_type'}{eq name='search_type' value='user_id'}selected{/eq}{/present}>用户ID</option>
                                       <option value="flag_id" {present name='search_type'}{eq name='search_type' value='flag_id'}selected{/eq}{/present}>FlagID</option>
                                   </select>
                               </div>
                                {php}
                                if(input('?param.search_typeid') || input('?param.search_name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('content')}">返回管理</a>
                                </div>{php}
                                }
                                {/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" id="filter" type="text"
                                           {php}
                                           if(input('?param.search_name')){
                                    if(input('param.search_name')){
                                    echo "value='".input('search_name')."'";
                                    }
                                    }
                                    {/php}
                                    name="search_name" placeholder="输入标题搜索">
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th data-align="center">动态ID</th>
                                    <th data-align="center">FlagID</th>
                                    <th data-align="center">管理</th>
                                    <th data-align="center">用户</th>
                                    <th>内容</th>
                                    <th>图片/视频</th>
                                    {eq name="cate" value="1"}
                                    <th data-align="center">进度</th>
                                    {/eq}
                                    <th data-align="center">反馈(通过:不通过)</th>
                                    <th data-align="center">评论</th>
                                    <th data-align="center">点赞</th>
                                    <th data-align="center">可见</th>
                                    <th data-align="center">时间</th>

                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v" key="k"}
                                <tr id="id{$v.id}" class="class">
                                    <td>{$v.id}</td>
                                    <td >
                                        <a onclick="flag('{$v.flag_id}')" style="color:#40BCF7">{$v.flag_id}</a>
                                    </td>
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onclick="del('{$v.id}')">删除</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                    <td >
                                        <a onclick="member('{$v.user_id}')" style="color:#40BCF7">{$v.username}</a><br/>({$v.user_id})
                                    </td>
                                    <td id="title">
                                        <a onclick="watch('{$v.content}')">
                                            <?php echo $v['content']; ?>
                                        </a>
                                    </td>
                                    <td>
                                        {eq name="v.type" value="1"}
                                        {volist name="$v.images" id="img"}
                                        <a href="{:strpos($img, 'http')===false?'__ROOT__':''}{$img}" target="_blank">
                                            <img style="width:80px;height:80px;" src="{:strpos($img, 'http')===false?'__ROOT__':''}{$img}"/>
                                        </a>
                                        {/volist}
                                        {else}
                                        <video id="video{$k}" class="video-js vjs-default-skin" controls preload="auto"></video>
                                        
                                        {/eq}
                                    </td>
                                    {eq name="cate" value="1"}
                                    <td>{$v.day} / {$v.days}</td>
                                    {/eq}
                                    <td>
                                    <a onclick="fed('{$v.id}', 1)" style="color:#40BCF7">{$v.fed_pass}</a>
                                    :
                                    <a onclick="fed('{$v.id}', 2)" style="color:#40BCF7">{$v.fed_miss}</a>
                                    </td>
                                    <td><span style="color:#40BCF7" onclick="comments('{$v.id}')">{$v.comments}</span></td>
                                    <td>{$v.likes}</td>
                                    <td>{$v.private ? '否' : '可见'}</td>
                                    <td>
                                        <span {php}if(date('Y-m-d')==date('Y-m-d', $v['create_time']))echo 'style="color: #ed5565"';{/php}>{:date('Y-m-d H:i:s', $v.create_time)}</span>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>

                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-6">
                    <a href="?order=1" type="button" class="btn btn-outline btn-default">
                        倒序排序
                    </a>
                    <a href="?order=2" type="button" class="btn btn-outline btn-default">
                        顺序排序
                    </a>

                </div>
                <div class="col-sm-6 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    function del(id){
        swal_del(id,"{:url('delecontent')}")
    }
    function watch(content) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['80vw', '500px'],
                type: 1,
                content: content
            });
        });
    }
    function member(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("member/index")}?search=id&name='+id
            });
        });
    }
    function flag(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("flag/list")}?search_typeid=id&search_name='+id
            });
        });
    }
    function fed(id, fed)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("flag/fed")}?search_type=flags_id&search_name='+id+'&fed='+fed
            });
        });
    }
    function comments(id)
    {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title :'预览',
                area: ['100%', '100%'],
                type: 2,
                content: '{:url("comment")}?search_type=flags_id&search_name='+id
            });
        });
    }
    setTimeout(() => {
        '{volist name="data" id="v" key="k"}{if condition="$v.video"}'
            videojs('video{$k}', {
                fluid: true,
                autoplay: false,
                width:150,
                sources: [{
                    src: "{:strpos($v.video, 'http')===false?'__ROOT__':''}{$v.video}",
                    <?php 
                    if (strpos($v['video'], 'm3u8') !== false) {
                        ?>
                    type: 'application/x-mpegURL'
                    <?php } ?>
                }]
            });
        '{/if}{/volist}'
    }, 300);
</script>
 